package at.ac.tuwien.infosys.aic11.dto;

import javax.xml.bind.annotation.*;
import java.io.Serializable;


@XmlRootElement(name = "rating")
@XmlAccessorType(XmlAccessType.NONE)
public class Rating implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	@XmlElement(name="customer_rating", required=true)
	private CustomerRating rating=CustomerRating.valueOf("Defaulting");
	@XmlTransient
	private long customerId;


	public Rating(){}
	
	public Rating(String r){
		rating = CustomerRating.valueOf(r);
	}
	
	public Rating(String r, long customerId){
		rating = CustomerRating.valueOf(r);
		this.customerId=customerId;
	}

	@XmlEnum
	public enum CustomerRating{
		@XmlEnumValue("AAA")
		AAA ("AAA"),
		@XmlEnumValue("AAPlus")
		AAPlus ("AAPlus"),
		@XmlEnumValue("AA")
		AA ("AA"),
		@XmlEnumValue("AAMinus")
		AAMinus ("AAMinus"),
		@XmlEnumValue("APlus")
		APlus ("APlus"),
		@XmlEnumValue("A")
		A ("A"),
		@XmlEnumValue("AMinus")
		AMinus ("AMinus"),
		@XmlEnumValue("Defaulting")
		Defaulting ("Defaulting");
		
		private CustomerRating(String value){
	        this.value = value;
	    }

	    private final String value;

	    public String getValue(){return value;}
	}
	

	public String getRating() {
		return rating.getValue();
	}

	public void setRating(String r) {
		rating = CustomerRating.valueOf(r);
	}
	
	public long getCustomerId() {
		return customerId;
	}

	public void setCustomerId(long customerId) {
		this.customerId = customerId;
	}

	
	
	
	
	
	

}
